#pragma once
#include <iostream>

#include "Common.hpp"

class ThreadCache
{
public:
    //线程申请内存块资源
    void* Allocate(size_t size);
    //线程释放内存块资源
    void Deallocate(void* ptr, size_t size);
    //从中心缓存中获取一批内存块
    void* FetchFromCentralCache(size_t size, size_t index);
private:
    Freelist _tc_freelists[NFREELIST];
};

//线程局部存储
static __thread ThreadCache* pTLSThreadCache = nullptr;